package com.example.demo.conf;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author Gong
 * @Description
 * @dATE 2021/12/8 11:14
 **/
public class FileUtil {
    // 删除文件及目录
//    static List<String> filePath;
    public static void getFileList(File folder,List<String> filePath) {

        File[] files = folder.listFiles();
        if (files != null) {
            for (File f : files) {
                if (f.isDirectory()) {
                    getFileList(f,filePath);
                } else {
                    filePath.add("http://119.23.55.53/imgs_happy_moment"+File.separator+f.getName());
//                    System.out.println(f.getName());
                }
            }
        }
    }

    public static void main(String[] args) {
        File folder = new File("D:\\workspace_vscode\\Aliyun\\html\\mysite\\img\\happy_moment");
        List<String> filePath  = new ArrayList<String>();
        FileUtil.getFileList(folder,filePath);
    }
}
